<template>
	<u-tabbar v-model="state.current" :list="state.list" @change="settabbar" :hideTabBar="false"></u-tabbar>
</template>

<script lang="ts" setup>
	import { reactive } from 'vue';
	import { onLoad } from '@dcloudio/uni-app'
	const props = defineProps({
		value: Number
	})
	const state = reactive({
		list: [
			{
				iconPath: "/static/tabbar/home.png",
				selectedIconPath: "/static/tabbar/home_active.png",
				text: '首页',
				urlKey: 'index',
				customIcon: false,
			}, {
				iconPath: "/static/tabbar/my.png",
				selectedIconPath: "/static/tabbar/my_active.png",
				text: '我的',
				urlKey: 'mine',
				customIcon: false,
			},
		],
		current: 0
	})
	onLoad(() => {
		state.current = props.value
	})
	const settabbar = (e) => {
		console.log(e)
		let val = state.list[e]
		uni.reLaunch({
			url: `/pages/tabbar/${val.urlKey}/${val.urlKey}`
		})
	}
</script>

<style scoped lang="less">
	.icon {
		width: 48rpx;
		height: 48rpx;

	}
</style>